<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use Illuminate\Routing\Router;

Route::get('/', function () {
    return '<h1>请用微信关注公众账号 “悦宝有约”</h1>';
});

Route::group([
    'prefix' => 'wx',
    'middleware' => ['web' , 'wechat_oauth'],
], function (Router $router) {
    $router->any('/regist', 'Wechat@regist')->name('wechat.regist');

    $router->group([
        'middleware' => ['user_babies']
    ], function (Router $router) {
        $router->get('/courses', 'Wechat@courses')->name('wechat.courses');
        $router->get('/courses_intro', 'Wechat@courses_intro')->name('wechat.courses_intro');
        $router->get('/subscribes', 'Wechat@subscribes')->name('wechat.subscribes');
        $router->post('/sub', 'Wechat@sub');
    });

    $router->any('/about', 'Wechat@about')->name('wechat.about');
    $router->get('/our_teachers', 'Wechat@our_teachers')->name('wechat.our_teachers');
    $router->get('/article/{id}', 'Wechat@article')->name('wechat.article');

});
